package com.example.a79273.shandianban.model;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import org.json.JSONException;
import org.json.JSONObject;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;

/**
 * "有人"页面中的下面的ViewPages通用javabean
 */
public class YouRenPageBean {

    /**
     * error_code : 0
     * error_msg : 获取分类设计师数据成功
     * data : {"list":[{"designerId":"236000170061","Hsrc":"/Upload/Designer/236000170061/381ccb8b10.jpg","Vsrc":"/Upload/Designer/236000170061/381cbc4a86.jpg","Asrc":"/Upload/Designer/236000170061/381ccb8b39.jpg","href":"api/Designer/GetDetail/236000170061","name":"林俊朝","fans":1},{"designerId":"214000354130","Hsrc":"/Upload/Designer/214000354130/381ccb8b9f.jpg","Vsrc":"/Upload/Designer/214000354130/381cbc4a6c.jpg","Asrc":"/Upload/Designer/214000354130/381ccb8b78.jpg","href":"api/Designer/GetDetail/214000354130","name":"黄荣秀","fans":5},{"designerId":"214000520032","Hsrc":"/Upload/Designer/214000520032/381ccb8b44.jpg","Vsrc":"/Upload/Designer/214000520032/381cbc4a5f.jpg","Asrc":"/Upload/Designer/214000520032/381ccb8b3b.jpg","href":"api/Designer/GetDetail/214000520032","name":"康梓","fans":8},{"designerId":"214000520071","Hsrc":"/Upload/Designer/214000520071/381ccb8b00.jpg","Vsrc":"/Upload/Designer/214000520071/381cbc4a9c.jpg","Asrc":"/Upload/Designer/214000520071/381ccb8b47.jpg","href":"api/Designer/GetDetail/214000520071","name":"Mr. Yeah","fans":5},{"designerId":"237000774091","Hsrc":"/Upload/Designer/237000774091/381cbc4c70.jpg","Vsrc":"/Upload/Designer/237000774091/381cbc49f8.jpg","Asrc":"/Upload/Designer/237000774091/381cbc4c67.jpg","href":"api/Designer/GetDetail/237000774091","name":"Andy","fans":7},{"designerId":"237000320031","Hsrc":"/Upload/Designer/237000320031/381cbc4c40.jpg","Vsrc":"/Upload/Designer/237000320031/381cbc4a3f.jpg","Asrc":"/Upload/Designer/237000320031/381ccb8b4b.jpg","href":"api/Designer/GetDetail/237000320031","name":"黄伟仪","fans":4},{"designerId":"214000354151","Hsrc":"/Upload/Designer/214000354151/381ccb8ba7.jpg","Vsrc":"/Upload/Designer/214000354151/381cbc4a75.jpg","Asrc":"/Upload/Designer/214000354151/381ccb8b9e.jpg","href":"api/Designer/GetDetail/214000354151","name":"Moses","fans":4}],"page_info":{"page_count":7,"page":1,"page_size":12}}
     */

    private int error_code;
    private String error_msg;
    /**
     * list : [{"designerId":"236000170061","Hsrc":"/Upload/Designer/236000170061/381ccb8b10.jpg","Vsrc":"/Upload/Designer/236000170061/381cbc4a86.jpg","Asrc":"/Upload/Designer/236000170061/381ccb8b39.jpg","href":"api/Designer/GetDetail/236000170061","name":"林俊朝","fans":1},{"designerId":"214000354130","Hsrc":"/Upload/Designer/214000354130/381ccb8b9f.jpg","Vsrc":"/Upload/Designer/214000354130/381cbc4a6c.jpg","Asrc":"/Upload/Designer/214000354130/381ccb8b78.jpg","href":"api/Designer/GetDetail/214000354130","name":"黄荣秀","fans":5},{"designerId":"214000520032","Hsrc":"/Upload/Designer/214000520032/381ccb8b44.jpg","Vsrc":"/Upload/Designer/214000520032/381cbc4a5f.jpg","Asrc":"/Upload/Designer/214000520032/381ccb8b3b.jpg","href":"api/Designer/GetDetail/214000520032","name":"康梓","fans":8},{"designerId":"214000520071","Hsrc":"/Upload/Designer/214000520071/381ccb8b00.jpg","Vsrc":"/Upload/Designer/214000520071/381cbc4a9c.jpg","Asrc":"/Upload/Designer/214000520071/381ccb8b47.jpg","href":"api/Designer/GetDetail/214000520071","name":"Mr. Yeah","fans":5},{"designerId":"237000774091","Hsrc":"/Upload/Designer/237000774091/381cbc4c70.jpg","Vsrc":"/Upload/Designer/237000774091/381cbc49f8.jpg","Asrc":"/Upload/Designer/237000774091/381cbc4c67.jpg","href":"api/Designer/GetDetail/237000774091","name":"Andy","fans":7},{"designerId":"237000320031","Hsrc":"/Upload/Designer/237000320031/381cbc4c40.jpg","Vsrc":"/Upload/Designer/237000320031/381cbc4a3f.jpg","Asrc":"/Upload/Designer/237000320031/381ccb8b4b.jpg","href":"api/Designer/GetDetail/237000320031","name":"黄伟仪","fans":4},{"designerId":"214000354151","Hsrc":"/Upload/Designer/214000354151/381ccb8ba7.jpg","Vsrc":"/Upload/Designer/214000354151/381cbc4a75.jpg","Asrc":"/Upload/Designer/214000354151/381ccb8b9e.jpg","href":"api/Designer/GetDetail/214000354151","name":"Moses","fans":4}]
     * page_info : {"page_count":7,"page":1,"page_size":12}
     */

    private DataBean data;

    public static YouRenPageBean objectFromData(String str) {

        return new Gson().fromJson(str, YouRenPageBean.class);
    }

    public static YouRenPageBean objectFromData(String str, String key) {

        try {
            JSONObject jsonObject = new JSONObject(str);

            return new Gson().fromJson(jsonObject.getString(str), YouRenPageBean.class);
        } catch (JSONException e) {
            e.printStackTrace();
        }

        return null;
    }

    public static List<YouRenPageBean> arrayYouRenPageBeanFromData(String str) {

        Type listType = new TypeToken<ArrayList<YouRenPageBean>>() {
        }.getType();

        return new Gson().fromJson(str, listType);
    }

    public static List<YouRenPageBean> arrayYouRenPageBeanFromData(String str, String key) {

        try {
            JSONObject jsonObject = new JSONObject(str);
            Type listType = new TypeToken<ArrayList<YouRenPageBean>>() {
            }.getType();

            return new Gson().fromJson(jsonObject.getString(str), listType);

        } catch (JSONException e) {
            e.printStackTrace();
        }

        return new ArrayList();


    }

    public int getError_code() {
        return error_code;
    }

    public void setError_code(int error_code) {
        this.error_code = error_code;
    }

    public String getError_msg() {
        return error_msg;
    }

    public void setError_msg(String error_msg) {
        this.error_msg = error_msg;
    }

    public DataBean getData() {
        return data;
    }

    public void setData(DataBean data) {
        this.data = data;
    }

    public static class DataBean {
        /**
         * page_count : 7
         * page : 1
         * page_size : 12
         */

        private PageInfoBean page_info;
        /**
         * designerId : 236000170061
         * Hsrc : /Upload/Designer/236000170061/381ccb8b10.jpg
         * Vsrc : /Upload/Designer/236000170061/381cbc4a86.jpg
         * Asrc : /Upload/Designer/236000170061/381ccb8b39.jpg
         * href : api/Designer/GetDetail/236000170061
         * name : 林俊朝
         * fans : 1
         */

        private List<ListBean> list;

        public static DataBean objectFromData(String str) {

            return new Gson().fromJson(str, DataBean.class);
        }

        public static DataBean objectFromData(String str, String key) {

            try {
                JSONObject jsonObject = new JSONObject(str);

                return new Gson().fromJson(jsonObject.getString(str), DataBean.class);
            } catch (JSONException e) {
                e.printStackTrace();
            }

            return null;
        }

        public static List<DataBean> arrayDataBeanFromData(String str) {

            Type listType = new TypeToken<ArrayList<DataBean>>() {
            }.getType();

            return new Gson().fromJson(str, listType);
        }

        public static List<DataBean> arrayDataBeanFromData(String str, String key) {

            try {
                JSONObject jsonObject = new JSONObject(str);
                Type listType = new TypeToken<ArrayList<DataBean>>() {
                }.getType();

                return new Gson().fromJson(jsonObject.getString(str), listType);

            } catch (JSONException e) {
                e.printStackTrace();
            }

            return new ArrayList();


        }

        public PageInfoBean getPage_info() {
            return page_info;
        }

        public void setPage_info(PageInfoBean page_info) {
            this.page_info = page_info;
        }

        public List<ListBean> getList() {
            return list;
        }

        public void setList(List<ListBean> list) {
            this.list = list;
        }

        public static class PageInfoBean {
            private int page_count;
            private int page;
            private int page_size;

            public static PageInfoBean objectFromData(String str) {

                return new Gson().fromJson(str, PageInfoBean.class);
            }

            public static PageInfoBean objectFromData(String str, String key) {

                try {
                    JSONObject jsonObject = new JSONObject(str);

                    return new Gson().fromJson(jsonObject.getString(str), PageInfoBean.class);
                } catch (JSONException e) {
                    e.printStackTrace();
                }

                return null;
            }

            public static List<PageInfoBean> arrayPageInfoBeanFromData(String str) {

                Type listType = new TypeToken<ArrayList<PageInfoBean>>() {
                }.getType();

                return new Gson().fromJson(str, listType);
            }

            public static List<PageInfoBean> arrayPageInfoBeanFromData(String str, String key) {

                try {
                    JSONObject jsonObject = new JSONObject(str);
                    Type listType = new TypeToken<ArrayList<PageInfoBean>>() {
                    }.getType();

                    return new Gson().fromJson(jsonObject.getString(str), listType);

                } catch (JSONException e) {
                    e.printStackTrace();
                }

                return new ArrayList();


            }

            public int getPage_count() {
                return page_count;
            }

            public void setPage_count(int page_count) {
                this.page_count = page_count;
            }

            public int getPage() {
                return page;
            }

            public void setPage(int page) {
                this.page = page;
            }

            public int getPage_size() {
                return page_size;
            }

            public void setPage_size(int page_size) {
                this.page_size = page_size;
            }
        }

        public static class ListBean {
            private String designerId;
            private String Hsrc;
            private String Vsrc;
            private String Asrc;
            private String href;
            private String name;
            private int fans;

            public static ListBean objectFromData(String str) {

                return new Gson().fromJson(str, ListBean.class);
            }

            public static ListBean objectFromData(String str, String key) {

                try {
                    JSONObject jsonObject = new JSONObject(str);

                    return new Gson().fromJson(jsonObject.getString(str), ListBean.class);
                } catch (JSONException e) {
                    e.printStackTrace();
                }

                return null;
            }

            public static List<ListBean> arrayListBeanFromData(String str) {

                Type listType = new TypeToken<ArrayList<ListBean>>() {
                }.getType();

                return new Gson().fromJson(str, listType);
            }

            public static List<ListBean> arrayListBeanFromData(String str, String key) {

                try {
                    JSONObject jsonObject = new JSONObject(str);
                    Type listType = new TypeToken<ArrayList<ListBean>>() {
                    }.getType();

                    return new Gson().fromJson(jsonObject.getString(str), listType);

                } catch (JSONException e) {
                    e.printStackTrace();
                }

                return new ArrayList();


            }

            public String getDesignerId() {
                return designerId;
            }

            public void setDesignerId(String designerId) {
                this.designerId = designerId;
            }

            public String getHsrc() {
                return Hsrc;
            }

            public void setHsrc(String Hsrc) {
                this.Hsrc = Hsrc;
            }

            public String getVsrc() {
                return Vsrc;
            }

            public void setVsrc(String Vsrc) {
                this.Vsrc = Vsrc;
            }

            public String getAsrc() {
                return Asrc;
            }

            public void setAsrc(String Asrc) {
                this.Asrc = Asrc;
            }

            public String getHref() {
                return href;
            }

            public void setHref(String href) {
                this.href = href;
            }

            public String getName() {
                return name;
            }

            public void setName(String name) {
                this.name = name;
            }

            public int getFans() {
                return fans;
            }

            public void setFans(int fans) {
                this.fans = fans;
            }
        }
    }
}
